package com.alibaba.taolele.unittest;


import com.alibaba.taolele.ExcelUtil;
import com.alibaba.taolele.dao.CouponSearchMapper;
import com.alibaba.taolele.dao.GoodsSearchMapper;
import com.alibaba.taolele.datamodel.Goods;
import com.alibaba.taolele.service.SearchSerive;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;

public class SearchSeriveTest extends BaseTester {

    @Autowired
    private SearchSerive searchSerive;
    @Autowired
    GoodsSearchMapper goodsSearchMapper;
    @Autowired
    CouponSearchMapper couponSearchMapper;
    @Test
    public void testetGoodsAndConponsPaging() throws Exception {
       Map wode = searchSerive.getGoodsAndConponsPaging("%wode%", 10, 1);
        System.out.println(wode);
    }

    @Test
    public void importData() throws Exception {
        List<Goods> data = ExcelUtil.getData("/Users/fulei.yang/IdeaProjects/shop/feature/gitosc/taolele/src/main/webapp/WEB-INF/assets/goodsinfo.xls");
        List<Goods> goods = data.subList(10, data.size());
        System.out.println(goods);
        for (Goods good : goods) {
            goodsSearchMapper.insertGoods(good);
            couponSearchMapper.insertCoupon(good.getCoupon());
        }
    }

    @Test
    public void search() throws Exception {
        /*List<Goods> goodsAndConponsPaging = searchSerive.getGoodsAndConponsPaging("%", 1, 1);
        System.out.println(goodsAndConponsPaging);*/
    }
}